<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%String path=request.getContextPath();pageContext.setAttribute("path",path); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" />
	<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
	<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
	
<title>查看回答</title>
</head>

<body>
	<div data-role="page" id="details">
    <div data-theme="a" data-role="header">
        <h3>
            查看回答
        </h3>
       
    </div>
    <div data-role="content">
            
            <div data-role="fieldcontain">
                <input name="subject"   value="${question.subject}" type="text" readonly="readonly">
            </div>
            <div data-role="fieldcontain">
                <textarea name="content"   readonly="readonly">${question.content}</textarea>
            </div>
            
            
            
            <c:if test="${isLock and question.status==1}">
            	<form action="${path}/answer/add.do" method="post"  data-ajax="false">
            		<div style=" ">
        				<label for="a_${question.qid}">我要解答</label>
        				<textarea name="content"    maxlength="1000"  required="true"  id="a_${question.qid}"></textarea>
        			</div>
        			
        			<input type="hidden" value="${question.qid}" name="question.qid">
        			<input type="submit" value="提交答案"  id="submit">
           		 </form>
            </c:if>
            
            <c:if test="${!isLock}">
            		 <h2> 该问题已被其他专家锁定或解答,您不能解答 !</h2>
            </c:if>
            
			
			<script type="text/javascript">
					$("#reSubmit_${question.qid}").click(function () {
						var result=false;
						var data={ id:"${question.qid}" };
						$.ajax({type:"POST",url:"${path}/question/reSubmit.do",data:data,async:false,dataType:"json",success:function(r){
							result=r.success;
							if(result){
								alert("提交成功!");
								$.mobile.changePage("${path}/question/details.do?id=${question.qid}&_t=<%=System.currentTimeMillis()%>");
							}else{
								alert("提交失败!");
							}
						}});
						return false;
					});
			</script>
    </div>
   <jsp:include page="foot.jsp"/>
</div>

</body>
</html>
